package com.qianniu.napi.admin.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.IdType;

import java.util.ArrayList;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;
import java.util.List;
import java.util.TreeSet;

/**
 * <p>
 * 配置表
 * </p>
 *
 * @author chenxuebin
 * @since 2018-09-08
 */
@TableName("t_config")
public class Config extends Model<Config> implements Comparable<Config> {

    private static final long serialVersionUID = 1L;

	@TableId(value="id", type= IdType.AUTO)

	private Long id;
    /**
     * 值&
     */
	private String name;
    /**
     * 名称&
     */
	private String code;
	private String pcode;
	private String extra;
    /**
     * 类型&
     */
	private String type;
	private String typename;
    /**
     * 启用状态&
     */
	private Integer state;

	private String remark;

	@JSONField(ordinal=1)
	private Integer sort;

	private Integer level;
	private Long pid;
	//资源ID
	private Long resid;
	//资源类型
	private String restype;

	private Long mid;
	private Long mpid;
	private Long sid;

	private Long uid;
	private Date createtime;
	private Date modifytime;
	private Long modifier;

	@TableField(exist = false)
	private Boolean active;
	@TableField(exist = false)
	private Boolean disabled;

	@TableField("is_system")
	private Integer isSystem;

	@TableField(exist = false)
	private TreeSet<Config> childs;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public Long getPid() {
		return pid;
	}

	public void setPid(Long pid) {
		this.pid = pid;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public Long getUid() {
		return uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}

	public TreeSet<Config> getChilds() {
		return childs;
	}

	public void setChilds(TreeSet<Config> childs) {
		this.childs = childs;
	}

	public Boolean getActive() {
		return active;
	}

	public void setActive(Boolean active) {
		this.active = active;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public String getPcode() {
		return pcode;
	}

	public void setPcode(String pcode) {
		this.pcode = pcode;
	}

	public Boolean getDisabled() {
		return disabled;
	}

	public void setDisabled(Boolean disabled) {
		this.disabled = disabled;
	}

	public Integer getIsSystem() {
		return isSystem;
	}

	public void setIsSystem(Integer isSystem) {
		this.isSystem = isSystem;
	}

	public Long getMid() {
		return mid;
	}

	public void setMid(Long mid) {
		this.mid = mid;
	}

	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	public Date getModifytime() {
		return modifytime;
	}

	public void setModifytime(Date modifytime) {
		this.modifytime = modifytime;
	}

	public Long getModifier() {
		return modifier;
	}

	public void setModifier(Long modifier) {
		this.modifier = modifier;
	}

	public Long getMpid() {
		return mpid;
	}

	public void setMpid(Long mpid) {
		this.mpid = mpid;
	}

	public String getExtra() {
		return extra;
	}

	public void setExtra(String extra) {
		this.extra = extra;
	}

	public String getTypename() {
		return typename;
	}

	public void setTypename(String typename) {
		this.typename = typename;
	}

	public Long getSid() {
		return sid;
	}

	public void setSid(Long sid) {
		this.sid = sid;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Long getResid() {
		return resid;
	}

	public void setResid(Long resid) {
		this.resid = resid;
	}

	public String getRestype() {
		return restype;
	}

	public void setRestype(String restype) {
		this.restype = restype;
	}

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

	@Override
	public String toString() {
		return "Config{" +
			"id=" + id +
			", name=" + name +
			", code=" + code +
			", type=" + type +
			", state=" + state +
			", pid=" + pid +
			", uid=" + uid +
			", createtime=" + createtime +
			", modifytime=" + modifytime +
			", modifier=" + modifier +
			"}";
	}

	@Override
	public int compareTo(Config c) {
		//根据id进行排序，若要进行升序在前面加一个负号
		return (this.id.intValue() - c.getId().intValue());
	}

}
